{#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Zenodo is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Zenodo; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
-#}
  <dl id="recordCommunityCuration">
    {%- if pending_comms %}
    <h5><i class="fa fa-legal"></i> <strong>Pending approvals</strong></h5>
      {%- for comm in pending_comms|sort(attribute='title') %}
        <dd>
          <div class="row">
            <div class="col-sm-6">
              {{ comm.title }}
            </div>
            <div class="col-sm-6">
              <span id="span-comm-{{ comm.id }}">
                <div class="hidden text-success accept-success-msg"><i class="fa fa-check"></i> Accepted</div>
                <div class="hidden text-success reject-success-msg"><i class="fa fa-times"></i> Rejected</div>
                <div class="hidden text-danger error-msg">An error occurred</div>

                <button class="btn-accept btn btn-xs btn-info"
                        type="button"
                        action="accept"
                        commId="{{ comm.id }}"
                        endpoint="{{url_for('zenodo_communities.curate', community_id=comm.id)}}"
                        recid="{{record.recid}}"><i class="fa fa-check"></i> Accept</button>
                <button class="btn-reject btn btn-xs btn-info"
                        type="button"
                        action="reject"
                        commId="{{ comm.id }}"
                        endpoint="{{url_for('zenodo_communities.curate', community_id=comm.id)}}"
                        recid="{{record.recid}}"><i class="fa fa-times"></i> Reject</button>
              </span>
            </div>
          </div>
        </dd>
      {%- endfor %}
    {%- endif %}
    {%- if accepted_comms %}
      <h5><i class="fa fa-group"></i> <strong>Communities</strong></h5>
      {%- for comm in accepted_comms|sort(attribute='title') %}
        <dd>
          <div class="row">
            <div class="col-sm-7">
              {{ comm.title }}
            </div>
            <div class="col-sm-5">
              <span id="span-comm-{{ comm.id }}">
                <div class="hidden text-success remove-success-msg"><i class="fa fa-check"></i>Removed</div>
                <div class="hidden text-danger error-msg">An error occurred</div>

                <button class="btn-remove btn btn-xs btn-info"
                        type="button"
                        action="remove"
                        commId="{{ comm.id }}"
                        endpoint="{{ url_for('zenodo_communities.curate', community_id=comm.id) }}"
                        recid="{{ record.recid }}"><i class="fa fa-times"></i> Remove</button>
              </span>
            </div>
          </div>
        </dd>
      {%- endfor %}
    {%- endif %}
  </dl>
